package cn.yuanqiao.archive.wenjianzhengli.domain;

import cn.yuanqiao.common.annotation.Excel;
import cn.yuanqiao.common.annotation.IdAnnotation;
import cn.yuanqiao.common.exception.ServiceException;
import cn.yuanqiao.common.utils.StringUtils;
import cn.yuanqiao.common.core.domain.BaseEntity;
import cn.yuanqiao.common.utils.SecurityUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

/**
 * 转换规则对象 YQ_CONVERSION_RULES
 * 
 * @author xy
 * @date 2024-01-17
 */
public class ConversionRules extends BaseEntity
{

    private final String BIGTABLENAME = "_YQ_CONVERSION_RULES";

    public ConversionRules() {
        String tenantCode = SecurityUtils.getTenantCode();
        if (StringUtils.isEmpty(tenantCode)) {
            throw new ServiceException("TenantCode is null");
        } else {
            this.tableName = tenantCode.toUpperCase() + BIGTABLENAME;
        }
    }
    private static final long serialVersionUID = 1L;

    /** ID */
    @IdAnnotation
    private Long id;

    /** 转换前格式 */
    @Excel(name = "转换前格式")
    private String beforeFormat;

    /** 转换后格式 */
    @Excel(name = "转换后格式")
    private String afterFormat;

    /** 转换类型 */
    @Excel(name = "转换类型")
    private String mediaType;

    /** 状态 */
    @Excel(name = "状态")
    private String state;

    private String tableName;

    public void setId(Long id)
    {
        this.id = id;
    }

    public Long getId()
    {
        return id;
    }
    public void setBeforeFormat(String beforeFormat) 
    {
        this.beforeFormat = beforeFormat;
    }

    public String getBeforeFormat() 
    {
        return beforeFormat;
    }
    public void setAfterFormat(String afterFormat) 
    {
        this.afterFormat = afterFormat;
    }

    public String getAfterFormat() 
    {
        return afterFormat;
    }
    public void setMediaType(String mediaType) 
    {
        this.mediaType = mediaType;
    }

    public String getMediaType() 
    {
        return mediaType;
    }
    public void setState(String state) 
    {
        this.state = state;
    }

    public String getState() 
    {
        return state;
    }

    public String getTableName() {
        return tableName;
    }

    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("beforeFormat", getBeforeFormat())
            .append("afterFormat", getAfterFormat())
            .append("mediaType", getMediaType())
            .append("state", getState())
            .toString();
    }
}
